﻿@model ZJK.Models.CategoryManage.vmCategoryIndex
@{
    ViewBag.Title = "专家分类管理";
    Layout = "~/Views/Shared/Category/_Layout_Category.cshtml";
}

@Styles.Render("~/Scripts/ztree/zTreeStyle.css")
@Scripts.Render("~/Scripts/ztree/jquery.ztree.all-3.5.min.js")
<script type="text/javascript" src="@Url.Content("~/Scripts/Category.js")"></script>
<h2>@ViewBag.Title</h2>
<script type="text/javascript">
    //树形的配置项目
    var setting = {
        view: {
            selectedMulti: false
        },
        check: {
            //chkboxType: { "Y": "ps", "N": "ps" },
            enable: false
        },
        data: {
            simpleData: {
                enable: true
            }
        },
        callback: {
            onClick: onClick
        }
    };

    
    //获取分类信息
    var strUrlgetCategoryById = '@Url.Content("~/Category/getCategoryById")';
    var strUrlgetCategorys = '@Url.Content("~/Category/getCategorys")';
    var strUrladdRootCategory = '@Url.Content("~/Category/newRootCategory")';
    var strUrladdSubCategory = '@Url.Content("~/Category/newSubCategory")';
    var strUrlsaveCategory = '@Url.Content("~/Category/saveCategory")';
    var strUrldeleteCategory = '@Url.Content("~/Category/deleteCategory")';

    $(document).ready(function () {
        //初始化专家分类树形
        getCategorys(strUrlgetCategorys);
    });
</script>
<div>
    <table class="ui-widget" style="border-collapse: collapse; width: 100%;">
        <tr>
            <th class="ui-widget-header ui-corner-all" style="width: 50%; padding: .5em;">
                类型列表
            </th>
            <td class="ui-widget-content ui-corner-all" style="width: 50%; padding: .5em;">
                <a href="javascript:newRoot()" class="btn"><span class="ui-icon ui-icon-flag"
                    style="float: left; margin-right: .3em;"></span>添加根节点类型</a> <a href="javascript:newSub()"
                        class="btn"><span class="ui-icon ui-icon-triangle-1-se" style="float: left; margin-right: .3em;">
                        </span>为当前类型添加子类型</a>
            </td>
        </tr>
        <tr>
            <td class="ui-widget-content ui-corner-all" style="width: 50%; padding: .5em;">
                <div style="height: 400px; overflow: scroll; background-color: #EEE;">
                    <ul id="treeCategory" class="ztree">
                    </ul>
                </div>
            </td>
            <td class="ui-widget-content ui-corner-all" style="width: 50%; padding: .5em; vertical-align: top;">
                <div style="overflow: hidden;">
                    <div style="position: relative; width: 40%; float: left;">
                        <div class="ui-widget-header ui-corner-all" style="position: relative; padding: 0.7em;">
                            <b>当前类型代码：</b>
                        </div>
                    </div>
                    <div style="position: relative; margin-left: 40%; overflow: hidden;">
                        <div style="padding: 0.7em;">
                            <input type="hidden" name="typeId" id="typeId" />
                            <input type="hidden" name="typePId" id="typePId" />
                            <input type="text" name="typeCode" id="typeCode" />
                        </div>
                    </div>
                    <div class="clear">
                    </div>
                </div>
                <div style="overflow: hidden;">
                    <div style="position: relative; width: 40%; float: left;">
                        <div class="ui-widget-header ui-corner-all" style="padding: 0.7em;">
                            <b>当前类型名称：</b>
                        </div>
                    </div>
                    <div style="position: relative; margin-left: 40%;">
                        <div style="padding: 0.7em;">
                            <input type="text" name="typeName" id="typeName" />
                        </div>
                    </div>
                    <div class="clear">
                    </div>
                </div>
                <div class="ui-widget-content ui-corner-all" style="overflow: hidden;">
                    <div>
                        <div style="padding: 0.7em; text-align: center;">
                            <a href="javascript:onSave()" class="btn"><span class="ui-icon ui-icon-circle-check"
                                style="float: left; margin-right: .3em;"></span>保存</a> <a href="javascript:onDelete()"
                                    class="btn"><span class="ui-icon ui-icon-circle-close" style="float: left; margin-right: .3em;">
                                    </span>删除</a> <a href="javascript:onCancel()" class="btn"><span class="ui-icon ui-icon-arrowreturnthick-1-w"
                                        style="float: left; margin-right: .3em;"></span>取消</a>
                        </div>
                    </div>
                    <div class="clear">
                    </div>
                </div>
            </td>
        </tr>
    </table>
</div>